Completed
Push — develop ( 1877e1...cf5c83 )
by Dominik
02:02
created

googleMaps.js ➔ ... ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
import $ from 'jquery'
2
3
let status
4
5
export function init (options) {
6
  if (!status) {
7
    const apiKey = options.apiKey
8
    const callback = `googleMaps_${Date.now()}`
9
    const url = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&callback=${callback}`
10
    status = new Promise((resolve, reject) => {
0 ignored issues
show
Unused Code introduced by
The parameter reject is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11
      window[callback] = () => {
12
        resolve()
13
      }
14
    })
15
    $.getScript(url)
16
  }
17
  return status
18
}
19